Skip to content

[Kotlin Sync] Add additional SearchOperator helper methods for the rest of the Atlas Search operators #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 2, 2025

Conversation

rachel-mack
Copy link
Collaborator

@rachel-mack rachel-mack commented Mar 25, 2025

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-48104

There is no atlas search page in this docs set.

Staging Links

  • aggregation
  • whats-new
  • Self-Review Checklist

    • Is this free of any warnings or errors in the RST?
    • Did you run a spell-check?
    • Did you run a grammar-check?
    • Are all the links working?
    • Are the facets and meta keywords accurate?

    Copy link

    netlify bot commented Mar 25, 2025

    Deploy Preview for docs-kotlin-sync ready!

    Name Link
    🔨 Latest commit 32f617c
    🔍 Latest deploy log https://app.netlify.com/sites/docs-kotlin-sync/deploys/67ec437f910d020008e7bc6c
    😎 Deploy Preview https://deploy-preview-87--docs-kotlin-sync.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @rachel-mack rachel-mack changed the title [JAVA] Add additional SearchOperator helper methods for the rest of the Atlas Search operators [Kotlin Sync] Add additional SearchOperator helper methods for the rest of the Atlas Search operators Mar 26, 2025
    @rustagir rustagir self-requested a review March 26, 2025 18:24
    @@ -42,6 +42,10 @@ and features:
    the :ref:`MONGODB-OIDC: Kubernetes <kotlin-sync-auth-kubernetes>`
    section of the Enterprise Authentication Mechanisms guide

    .. replacement:: atlas-query-operators

    the `SearchOperator Interface API documentation <{+api+}/com/mongodb/client/model/search/SearchOperator.html>`__
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: there's no search page but there is a section on the Aggregation page. Consider adding a note there?

    @rachel-mack rachel-mack requested a review from rustagir March 27, 2025 19:58
    Comment on lines 83 to 86
    .. _kotlin-sync-atlas-search-stage:

    Pipelines Stages for Atlas Search
    ---------------------------------
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: Consider moving this section after the main aggregation examples on this page. Also consider renaming this section to just Atlas Search and then creating a subsection after the paragraph called Create a Search Query or something like that?

    Comment on lines 88 to 93
    :atlas:`Atlas Search </atlas-search>` queries take the form of an aggregation pipeline stage. Atlas
    Search provides ``$search`` and ``$searchMeta`` stages, both of which must be the first
    stage in any query pipeline. For more information about Atlas pipeline stages,
    see the :atlas:`Choose the Aggregation Pipeline Stage
    </atlas-search/query-syntax/>` page in the Atlas
    manual.
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: simplify/combine sentences

    Suggested change
    :atlas:`Atlas Search </atlas-search>` queries take the form of an aggregation pipeline stage. Atlas
    Search provides ``$search`` and ``$searchMeta`` stages, both of which must be the first
    stage in any query pipeline. For more information about Atlas pipeline stages,
    see the :atlas:`Choose the Aggregation Pipeline Stage
    </atlas-search/query-syntax/>` page in the Atlas
    manual.
    You can perform an :atlas:`Atlas Search </atlas-search>` query by creating an aggregation pipeline
    that contains one of the following pipeline stages:
    - ``$search``
    - ``$searchMeta``
    For more information about Atlas pipeline stages, see the :atlas:`Choose the Aggregation Pipeline Stage
    </atlas-search/query-syntax/>` page in the Atlas documentation.

    </atlas-search/query-syntax/>` page in the Atlas
    manual.

    .. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: consider revising the language in the table in this shared include to have the first column header be Operator instead of operation (as this is what they are referred to in the linked atlas docs`

    Comment on lines 99 to 115
    .. code-block:: kotlin

    val searchStage: Bson = Aggregates.search(
    SearchOperator.compound()
    .filter(
    listOf(
    SearchOperator.text(fieldPath("genres"), "Drama"),
    SearchOperator.phrase(fieldPath("cast"), "sylvester stallone"),
    SearchOperator.numberRange(fieldPath("year")).gtLt(1980, 1989),
    SearchOperator.wildcard(fieldPath("title"), "Rocky *")
    )
    )
    )

    .. replacement:: searchoperator-interface-api-docs

    the `SearchOperator Interface API documentation <{+core-api+}/client/model/search/SearchOperator.html>`__
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: correct the indentation of the replacement content


    .. sharedinclude:: dbx/jvm/atlas-search-operator-helpers.rst

    .. replacement:: atlas-query-operators-example
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: in the docs-shared file - change the code description to actually reference the strings as they appear in the text. This is helpful for making sure users see the 1:1 mapping of the description to the code example
    i.e
    The following code creates a search stage for a pipeline with the following filters:

    • genres array field includes "drama"

    etc

    Comment on lines 99 to 112
    .. code-block:: kotlin

    val searchStage: Bson = Aggregates.search(
    SearchOperator.compound()
    .filter(
    listOf(
    SearchOperator.text(fieldPath("genres"), "Drama"),
    SearchOperator.phrase(fieldPath("cast"), "sylvester stallone"),
    SearchOperator.numberRange(fieldPath("year")).gtLt(1980, 1989),
    SearchOperator.wildcard(fieldPath("title"), "Rocky *")
    )
    )
    )

    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    S: use a literalinclude and include output

    Comment on lines 47 to 48
    the :ref:`Pipelines Stages for Atlas Search
    <kotlin-sync-atlas-search-stage>` section
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggested change
    the :ref:`Pipelines Stages for Atlas Search
    <kotlin-sync-atlas-search-stage>` section
    the :ref:`kotlin-sync-atlas-search-stage` section of the Aggregation guide

    @rachel-mack rachel-mack requested a review from rustagir March 28, 2025 17:39
    @rachel-mack rachel-mack requested a review from a team as a code owner March 29, 2025 03:25
    @rachel-mack rachel-mack requested review from stIncMale and removed request for a team March 29, 2025 03:25
    @rachel-mack rachel-mack merged commit 80461ae into mongodb:master Apr 2, 2025
    7 checks passed
    github-actions bot pushed a commit that referenced this pull request Apr 2, 2025
    …st of the Atlas Search operators (#87)
    
    * atlas search page
    
    * aggregation section
    
    * link
    
    * fix link
    
    * eg search stage
    
    * fix core-api usage
    
    * RR review
    
    * add projection
    
    * format
    
    * eg
    
    * wip
    
    * wip
    
    * wip
    
    * WIP
    
    * Update whats-new.txt
    
    ---------
    
    Co-authored-by: Rea Rustagi <[email protected]>
    Co-authored-by: rustagir <[email protected]>
    (cherry picked from commit 80461ae)
    rachel-mack added a commit that referenced this pull request Apr 2, 2025
    …st of the Atlas Search operators (#87) (#91)
    
    * atlas search page
    
    * aggregation section
    
    * link
    
    * fix link
    
    * eg search stage
    
    * fix core-api usage
    
    * RR review
    
    * add projection
    
    * format
    
    * eg
    
    * wip
    
    * wip
    
    * wip
    
    * WIP
    
    * Update whats-new.txt
    
    ---------
    
    Co-authored-by: Rea Rustagi <[email protected]>
    Co-authored-by: rustagir <[email protected]>
    (cherry picked from commit 80461ae)
    
    Co-authored-by: Rachel Mackintosh <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants